package cn.tedu.jsd2205the.back.end.project.controller;


import cn.tedu.jsd2205the.back.end.project.pojo.vo.CommentVO;
import cn.tedu.jsd2205the.back.end.project.service.ICommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@Api(tags = "评论模块")
@RequestMapping( "/comment")
public class CommentController {

    @Autowired
    ICommentService service;

    /**
     * 获取商品的评论
     * @param productId
     * @return
     */
    @ApiOperation("获取商品的评论")
    @GetMapping("/selectByProductId")
    public List<CommentVO> selectByProductId(String productId) {
        log.trace("通过商品id{}查询商品的评论", productId);
        List<CommentVO> list = service.selectByProductId(productId);
        log.trace("查询结果：{}", list);
        return list;
    }

}
